﻿package fab.geom
{
	import flash.geom.Point;
	
	public class DoublePoint
	{
		public var position1:Point = new Point(0, 0);
		public var position2:Point = new Point(0, 0);
		
		public function DoublePoint( p1:Point, p2:Point )
		{
			position1 = p1;			
			position2 = p2;			
		}
		static public function interpolate( dp:DoublePoint, pivot:Point, f:Number ):DoublePoint
		{
			return new DoublePoint( Point.interpolate(dp.position1, pivot, f ), Point.interpolate(dp.position2, pivot, f ) );
		}		
		static public function double_interpolate( dp1:DoublePoint, dp2:DoublePoint, f:Number ):DoublePoint
		{
			return new DoublePoint( Point.interpolate(dp1.position1, dp2.position1, f ), Point.interpolate(dp1.position2, dp2.position2,  f ) );
		}			
		public function offset( fx:Number, fy:Number ):void
		{
			position1.offset( fx, fy );
			position2.offset( fx, fy );	
		}	
		public function multiply( fx:Number, fy:Number ):void
		{
			position1.x *= fx;
			position1.y*= fy;
			position2.x *= fx;
			position2.y *= fy;
		}		
		public function clone():DoublePoint
		{
			return new DoublePoint( new Point( position1.x, position1.y ), new Point( position2.x, position2.y ) );
		}
		static public function origine():DoublePoint
		{
			return new DoublePoint( new Point(), new Point() );
		}		
	}	
}